#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
class Solution
{
public:
    /**
     * @brief map
     *
     * @param words1
     * @param words2
     * @return int
     */
    int countWords(vector<string> &words1, vector<string> &words2)
    {
        unordered_map<string, int> freqWords1, freqWords2;
        for (const string &s : words1)
        {
            ++freqWords1[s];
        }
        for (const string &s : words2)
        {
            ++freqWords2[s];
        }
        int ans = 0;
        for (auto &[k, v] : freqWords1)
        {
            if (v == 1 == freqWords2[k])
            {
                ans++;
            }
        }
        return ans;
    }

    /**
     * @brief 排序+双指针
     *
     * @param words1
     * @param words2
     * @return int
     */
    int countWords_2(vector<string> &words1, vector<string> &words2)
    {
        sort(words1.begin(), words1.end());
        sort(words2.begin(), words2.end());

        int ans = 0;
        int left=0;
        return ans;
    }
};
int main()
{
    Solution s;
    vector<string> words1 = {"a", "ab"};
    vector<string> words2 = {"a", "a", "a", "ab"};
    cout << s.countWords(words1, words2) << endl;
    return 0;
}